package com.mark.design.principle.openclose2;

import org.junit.Test;

/**
 * @Description:
 * @Author: Kingsley
 * @CreateDate: 2018/11/25 18:45
 * @Version: 2.0
 * @Copyright : 豆浆油条个人非正式工作室
 */
public class Client {

    /**
     * 需求1:录入书本《悲伤逆流成河的信息》，并打印信息
     */
    @Test
    public void test1(){
        IBook iBook = new CryMeASadRiverBookImpl("小四","《悲伤逆流成河》",10);
        System.out.println("书名："+iBook.queryBookName());
        System.out.println("作者："+iBook.queryAuthor());
        System.out.println("售价："+iBook.queryPrice());
    }

    /**
     * 新需求：4月23日读书日到了书本《悲伤逆流成河》书本售价打5折
     */
    @Test
    public void test2(){
        IBook iBook = new CryMeASadRiverBookDisCountImpl("小四","《悲伤逆流成河》",10);
        System.out.println("书名："+iBook.queryBookName());
        System.out.println("作者："+iBook.queryAuthor());
        System.out.println("售价："+iBook.queryPrice());
        CryMeASadRiverBookDisCountImpl disCount = (CryMeASadRiverBookDisCountImpl) iBook;
        System.out.println("折后价:"+disCount.queryDicountPrice());
    }

}
